package com.jlboot.app.admin.validate;

import com.jlboot.core.base.Validator;
import com.jfinal.core.Controller;

/**
 * Created by 51594 on 2022/9/11.
 */
public class SysRoleValidator extends Validator {

    /**
     * validate
     *
     * @param controller
     */
    protected void validate(Controller controller) {
        validateRequiredString("name", "角色名称不能为空");
        validateRequiredLength("code", 4, 13, "角色编号应为{1}-{2}个字符");
        if (!isEdit()) validateFieldExit("sys_role", "code", "角色编号{1}已存在");
    }
}

